/**
 * 
 */
package com.jdy.haoduoaiteacher.adapter;

import com.jdy.haoduoaiteacher.enums.PosterType;
import com.jdy.haoduoaiteacher.enums.SendState;
import com.jdy.haoduoaiteacher.enums.SpeakForYouType;

/**
 * @author zp 2016-5-27 下午3:34:47
 */
public class SpeakForYouItem {

  public String Caption;

  public String Src;

  public SendState State;

  public int id;

  public int episode_id;

  public SpeakForYouType SFYType;

  public int SuccessState;

  public int hasRead = 0;

  public int length;

  public int audio_length;

  public String relativeAudioPath;

  public PosterType posterType = PosterType.None;

  public String createAt;

  public SpeakForYouItem(String name, String cover, int _id, int _episodeId,
                         SpeakForYouType sfyt, int success, PosterType pType, String created_at) {
    this.SFYType = sfyt;
    this.Caption = name;
    this.Src = cover;
    this.State = SendState.NONE;
    this.id = _id;
    this.episode_id = _episodeId;
    this.SuccessState = success;
    this.posterType = pType;
    this.createAt = created_at;
    if (success == 1) {
      this.State = State.SUCCESS;
    } else {
      this.State = State.FAILED;
    }
  }

  public SpeakForYouItem(String address, SpeakForYouType sfyt, int success,
                         PosterType pType, String created_at, int _id, int _episodeId) {
    this.id = _id;
    this.episode_id = _episodeId;
    this.SFYType = sfyt;
    this.posterType = pType;
    this.createAt = created_at;
    switch (sfyt) {
    case TEXT:
      this.Caption = address;
      this.Src = "";
      break;
    case VOICE:
      this.Caption = "";
      this.Src = address;
      break;
    default:
      break;
    }
    this.State = SendState.NONE;
    this.SuccessState = success;
    if (success == 1) {
      this.State = State.SUCCESS;
    } else {
      this.State = State.FAILED;
    }
  }

  // /*
  // * (non-Javadoc)
  // *
  // * @see java.lang.Comparable#compareTo(java.lang.Object)
  // */
  // @Override
  // public int compareTo(SpeakForYouItem another) {
  // // TODO Auto-generated method stub
  // if (id < another.id) {
  // return 1;
  // } else if (id > another.id) {
  // return -1;
  // } else {
  // return 0;
  // }
  // }

}
